package jsyf.oa.web.system;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.Api;
import jsyf.com.util.BaseUtils;
import jsyf.com.util.ResponseUtils;
import jsyf.oa.entity.system.CompanyEntity;
import jsyf.oa.facade.system.EnumFacade;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * Created by Administrator on 2017/12/7 0007.
 */
@Api(value = "枚举接口", description = "枚举接口")
@Controller
@RequestMapping("/enum")
public class EnumController {
    @Resource
    private EnumFacade enumFacade;

    @RequestMapping(value = "/selectByType.json", method = RequestMethod.POST)
    public void selectByType(HttpServletResponse response, @RequestBody String jsonData) {
        JSONObject obj = JSON.parseObject(jsonData);
        String enumType = obj.getString("enumType");
        List<JSONObject> objectList = enumFacade.selectByType(enumType);
        ResponseUtils.putJsonResponse(response, BaseUtils.succsessArrRespond(objectList));
    }
}
